<template>
  <div class="opacity">
    <V-CommonHeaderLeft>
      <div id="app">
        <el-row>
          <!-- 头部 -->
          <div class="header">
            <el-col :span="3" class="header-nav">
              <router-link to="/">首页&nbsp;&nbsp;/</router-link>
              <router-link to="/">应用&nbsp;&nbsp;/</router-link>
              <router-link to="/">报表设置</router-link>
            </el-col>
            <el-col :span="1" :offset="20">
              <img src alt class="shuImg">
            </el-col>
          </div>
        </el-row>
        <div class="contents">
          <h3>|报表设置</h3>
          <el-radio v-model="radio" label="1" @click.native='blockPush()'>按单据提交时间统计</el-radio>
          <el-radio v-model="radio" label="2" @click.native='hiddenFinsh()'>按单据完成时间统计</el-radio>
          <div class="tanChecked" v-show="showChecked">
            <p>请选择需要计入统计的单据：</p>
            <div class="tanChecked-checkAll">
              <span>订货单</span>
              <el-checkbox
                :indeterminate="isIndeterminate"
                v-model="checkAll"
                @change="handleCheckAllChange"
              >全选</el-checkbox>
              <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
                <el-checkbox v-for="city in cities" :label="city" :key="city">{{city}}</el-checkbox>
              </el-checkbox-group>
            </div>

            <div class="tanChecked-checkAll">
              <span>订货单</span>
              <el-checkbox
                :indeterminate="isIndeterminate2"
                v-model="checkAll2"
                @change="handleCheckAllChange2"
              >全选</el-checkbox>
              <el-checkbox-group v-model="checkedCities2" @change="handleCheckedCitiesChange2">
                <el-checkbox v-for="city2 in cities2" :label="city2" :key="city2">{{city2}}</el-checkbox>
              </el-checkbox-group>
            </div>
          </div>
        </div>
        <div class="footer">
          <button>保存</button>
        </div>
      </div>
    </V-CommonHeaderLeft>
  </div>
</template>

<script>
import VCommonHeaderLeft from './../common/vCommonHeaderLeft/VCommonHeaderLeft'
const cityOptions = ['待订单审核', '待财务审核', '待出库', '待发货', '待收货', '已完成']
const cityOptions2 = ['待订单审核', '待财务审核', '待入库', '待付款', '已完成']
export default {
  components: {
    VCommonHeaderLeft
  },
  data () {
    return {
      radio: '1',
      showChecked: true,
      checkAll: false,
      checkedCities: ['待订单审核', '待财务审核'],
      cities: cityOptions,
      isIndeterminate: true,
      checkAll2: false,
      checkedCities2: ['待订单审核', '待财务审核'],
      cities2: cityOptions2,
      isIndeterminate2: true
    }
  },
  methods: {
    handleCheckAllChange (val) {
      this.checkedCities = val ? cityOptions : []
      this.isIndeterminate = false
    },
    handleCheckedCitiesChange (value) {
      let checkedCount = value.length
      this.checkAll = checkedCount === this.cities.length
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length
    },

    handleCheckAllChange2 (val2) {
      this.checkedCities2 = val2 ? cityOptions2 : []
      this.isIndeterminate2 = false
    },
    handleCheckedCitiesChange2 (value2) {
      let checkedCount2 = value2.length
      this.checkAll2 = checkedCount2 === this.cities2.length
      this.isIndeterminate2 = checkedCount2 > 0 && checkedCount2 < this.cities2.length
    },
    blockPush () {
      this.showChecked = true
    },
    hiddenFinsh () {
      this.showChecked = false
    }
  }
}
</script>

<style lang="scss" scoped>
#app {
  width: 100%;
  background-color: #f2f5f7;
  height: 100%;
  padding: 15px 10px 0px 10px;
}
.header {
  height: 45px;
  .header-nav {
    line-height: 30px;
    font-size: 12px;
    display: flex;
    justify-content: space-around;
    padding-left: 10px;
    span {
      display: inline-block;
      margin-left: 10px;
    }
    a {
      color: #999999;
    }
    a:hover {
      color: #20ade5;
    }
  }
  .header-img {
    width: 25px;
    height: 25px;
    border-radius: 5px;
    border: 1px solid #dce4e7;
  }
}
.header-nav a:nth-child(3) {
  color: #333;
}
.header-nav a:nth-child(3):hover {
  color: #333;
}
.shuImg {
  width: 20px;
  height: 20px;
  border: 1px solid;
}
.contents {
  padding: 40px 10px 0px 10px;
  height: 420px;
  background-color: #fff;
}
.contents > h3 {
  font-size: 16px;
  width: 100%;
  margin-bottom: 30px;
}
.tanChecked {
  height:100px;
   margin:20px 0px 0px 0px;
   background:url('./../../../static/images/reportJu.png') no-repeat;
   background-position: 0px 0px;
   background-size: 100% 100px;
   padding:20px 0px 0px 35px;
}
.tanChecked-checkAll {
  display: flex;
  margin-bottom:10px;
}
.tanChecked-checkAll > span {
  font-size: 12px;
  color: #666;
  display: block;
  margin-right: 10px;
}
.tanChecked > p {
  color: #666666;
  font-size: 12px;
}
.footer {
  width:100%;
  background-color:#fff;
  border-top:1px solid #e3e3e3;
  height:60px;
}
.footer>button {
  width:155px;
  height:45px;
  background-color:#20ade5;
  font-size:12px;
  color:#fff;
  border:0;
  text-align:center;
  line-height:45px;
  float:right;
  margin:10px 15px 0px 0px;
  border-radius: 5px;
  cursor: pointer;
}
</style>
